home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
src
/
demos
/
GL
/
ideas
/
draw_logo.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-01
|
14KB
|
503 lines
/*
* Copyright 1992, 1993, 1994, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
* the contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
* rights reserved under the Copyright Laws of the United States.
*/
#include <gl.h>
#include "objects.h"
static float scp[18][3] = {
{1.000000, 0.000000, 0.000000}, {1.000000, 0.000000, 5.000000},
{0.707107, 0.707107, 0.000000}, {0.707107, 0.707107, 5.000000},
{0.000000, 1.000000, 0.000000}, {0.000000, 1.000000, 5.000000},
{-0.707107, 0.707107, 0.000000}, {-0.707107, 0.707107, 5.000000},
{-1.000000, 0.000000, 0.000000}, {-1.000000, 0.000000, 5.000000},
{-0.707107, -0.707107, 0.000000}, {-0.707107, -0.707107, 5.000000},
{0.000000, -1.000000, 0.000000}, {0.000000, -1.000000, 5.000000},
{0.707107, -0.707107, 0.000000}, {0.707107, -0.707107, 5.000000},
{1.000000, 0.000000, 0.000000}, {1.000000, 0.000000, 5.000000},
};
static float dcp[18][3] = {
{1.000000, 0.000000, 0.000000}, {1.000000, 0.000000, 7.000000},
{0.707107, 0.707107, 0.000000}, {0.707107, 0.707107, 7.000000},
{0.000000, 1.000000, 0.000000}, {0.000000, 1.000000, 7.000000},
{-0.707107, 0.707107, 0.000000}, {-0.707107, 0.707107, 7.000000},
{-1.000000, 0.000000, 0.000000}, {-1.000000, 0.000000, 7.000000},
{-0.707107, -0.707107, 0.000000}, {-0.707107, -0.707107, 7.000000},
{0.000000, -1.000000, 0.000000}, {0.000000, -1.000000, 7.000000},
{0.707107, -0.707107, 0.000000}, {0.707107, -0.707107, 7.000000},
{1.000000, 0.000000, 0.000000}, {1.000000, 0.000000, 7.000000},
};
static float ep[7][9][3] = {
{
{1.000000, 0.000000, 0.000000},
{0.707107, 0.707107, 0.000000},
{0.000000, 1.000000, 0.000000},
{-0.707107, 0.707107, 0.000000},
{-1.000000, 0.000000, 0.000000},
{-0.707107, -0.707107, 0.000000},
{0.000000, -1.000000, 0.000000},
{0.707107, -0.707107, 0.000000},
{1.000000, 0.000000, 0.000000},
},
{
{1.000000, 0.034074, 0.258819},
{0.707107, 0.717087, 0.075806},
{0.000000, 1.000000, 0.000000},
{-0.707107, 0.717087, 0.075806},
{-1.000000, 0.034074, 0.258819},
{-0.707107, -0.648939, 0.441832},
{0.000000, -0.931852, 0.517638},
{0.707107, -0.648939, 0.441832},
{1.000000, 0.034074, 0.258819},
},
{
{1.000000, 0.133975, 0.500000},
{0.707107, 0.746347, 0.146447},
{0.000000, 1.000000, 0.000000},
{-0.707107, 0.746347, 0.146447},
{-1.000000, 0.133975, 0.500000},
{-0.707107, -0.478398, 0.853553},
{0.000000, -0.732051, 1.000000},
{0.707107, -0.478398, 0.853553},
{1.000000, 0.133975, 0.500000},
},
{
{1.000000, 0.292893, 0.707107},
{0.707107, 0.792893, 0.207107},
{0.000000, 1.000000, 0.000000},
{-0.707107, 0.792893, 0.207107},
{-1.000000, 0.292893, 0.707107},
{-0.707107, -0.207107, 1.207107},
{0.000000, -0.414214, 1.414214},
{0.707107, -0.207107, 1.207107},
{1.000000, 0.292893, 0.707107},
},
{
{1.000000, 0.500000, 0.866025},
{0.707107, 0.853553, 0.253653},
{0.000000, 1.000000, 0.000000},
{-0.707107, 0.853553, 0.253653},
{-1.000000, 0.500000, 0.866025},
{-0.707107, 0.146447, 1.478398},
{0.000000, 0.000000, 1.732051},
{0.707107, 0.146447, 1.478398},
{1.000000, 0.500000, 0.866025},
},
{
{1.000000, 0.741181, 0.965926},
{0.707107, 0.924194, 0.282913},
{0.000000, 1.000000, 0.000000},
{-0.707107, 0.924194, 0.282913},
{-1.000000, 0.741181, 0.965926},
{-0.707107, 0.558168, 1.648939},
{0.000000, 0.482362, 1.931852},
{0.707107, 0.558168, 1.648939},
{1.000000, 0.741181, 0.965926},
},
{
{1.000000, 1.000000, 1.000000},
{0.707107, 1.000000, 0.292893},
{0.000000, 1.000000, 0.000000},
{-0.707107, 1.000000, 0.292893},
{-1.000000, 1.000000, 1.000000},
{-0.707107, 1.000000, 1.707107},
{0.000000, 1.000000, 2.000000},
{0.707107, 1.000000, 1.707107},
{1.000000, 1.000000, 1.000000},
},
};
static float en[7][9][3] = {
{
{1.000000, 0.000000, 0.000000},
{0.707107, 0.707107, 0.000000},
{0.000000, 1.000000, 0.000000},
{-0.707107, 0.707107, 0.000000},
{-1.000000, 0.000000, 0.000000},
{-0.707107, -0.707107, 0.000000},
{0.000000, -1.000000, 0.000000},
{0.707107, -0.707107, 0.000000},
{1.000000, 0.000000, 0.000000},
},
{
{1.000000, 0.000000, 0.000000},
{0.707107, 0.683013, -0.183013},
{0.000000, 0.965926, -0.258819},
{-0.707107, 0.683013, -0.183013},
{-1.000000, 0.000000, 0.000000},
{-0.707107, -0.683013, 0.183013},
{0.000000, -0.965926, 0.258819},
{0.707107, -0.683013, 0.183013},
{1.000000, 0.000000, 0.000000},
},
{
{1.000000, 0.000000, 0.000000},
{0.707107, 0.612372, -0.353553},
{0.000000, 0.866025, -0.500000},
{-0.707107, 0.612372, -0.353553},
{-1.000000, 0.000000, 0.000000},
{-0.707107, -0.612372, 0.353553},
{0.000000, -0.866025, 0.500000},
{0.707107, -0.612372, 0.353553},
{1.000000, 0.000000, 0.000000},
},
{
{1.000000, 0.000000, 0.000000},
{0.707107, 0.500000, -0.500000},
{0.000000, 0.707107, -0.707107},
{-0.707107, 0.500000, -0.500000},
{-1.000000, 0.000000, 0.000000},
{-0.707107, -0.500000, 0.500000},
{0.000000, -0.707107, 0.707107},
{0.707107, -0.500000, 0.500000},
{1.000000, 0.000000, 0.000000},
},
{
{1.000000, 0.000000, 0.000000},
{0.707107, 0.353553, -0.612372},
{0.000000, 0.500000, -0.866025},
{-0.707107, 0.353553, -0.612372},
{-1.000000, 0.000000, 0.000000},
{-0.707107, -0.353553, 0.612372},
{0.000000, -0.500000, 0.866025},
{0.707107, -0.353553, 0.612372},
{1.000000, 0.000000, 0.000000},
},
{
{1.000000, 0.000000, 0.000000},
{0.707107, 0.183013, -0.683013},
{0.000000, 0.258819, -0.965926},
{-0.707107, 0.183013, -0.683013},
{-1.000000, 0.000000, 0.000000},
{-0.707107, -0.183013, 0.683013},
{0.000000, -0.258819, 0.965926},
{0.707107, -0.183013, 0.683013},
{1.000000, 0.000000, 0.000000},
},
{
{1.000000, 0.000000, 0.000000},
{0.707107, 0.000000, -0.707107},
{0.000000, 0.000000, -1.000000},
{-0.707107, 0.000000, -0.707107},
{-1.000000, 0.000000, 0.000000},
{-0.707107, 0.000000, 0.707107},
{0.000000, 0.000000, 1.000000},
{0.707107, 0.000000, 0.707107},
{1.000000, 0.000000, 0.000000},
},
};
static draw_single_cylinder() {
bgntmesh();
n3f(scp[0]); v3f(scp[0]);
n3f(scp[0]); v3f(scp[1]);
n3f(scp[2]); v3f(scp[2]);
n3f(scp[2]); v3f(scp[3]);
n3f(scp[4]); v3f(scp[4]);
n3f(scp[4]); v3f(scp[5]);
n3f(scp[6]); v3f(scp[6]);
n3f(scp[6]); v3f(scp[7]);
n3f(scp[8]); v3f(scp[8]);
n3f(scp[8]); v3f(scp[9]);
n3f(scp[10]); v3f(scp[10]);
n3f(scp[10]); v3f(scp[11]);
n3f(scp[12]); v3f(scp[12]);
n3f(scp[12]); v3f(scp[13]);
n3f(scp[14]); v3f(scp[14]);
n3f(scp[14]); v3f(scp[15]);
n3f(scp[16]); v3f(scp[16]);
n3f(scp[16]); v3f(scp[17]);
endtmesh();
}
static draw_double_cylinder() {
bgntmesh();
n3f(dcp[0]); v3f(dcp[0]);
n3f(dcp[0]);
v3f(dcp[1]);
n3f(dcp[2]); v3f(dcp[2]);
n3f(dcp[2]);
v3f(dcp[3]);
n3f(dcp[4]); v3f(dcp[4]);
n3f(dcp[4]);
v3f(dcp[5]);
n3f(dcp[6]); v3f(dcp[6]);
n3f(dcp[6]);
v3f(dcp[7]);
n3f(dcp[8]); v3f(dcp[8]);
n3f(dcp[8]);
v3f(dcp[9]);
n3f(dcp[10]); v3f(dcp[10]);
n3f(dcp[10]);
v3f(dcp[11]);
n3f(dcp[12]); v3f(dcp[12]);
n3f(dcp[12]);
v3f(dcp[13]);
n3f(dcp[14]); v3f(dcp[14]);
n3f(dcp[14]);
v3f(dcp[15]);
n3f(dcp[16]); v3f(dcp[16]);
n3f(dcp[16]);
v3f(dcp[17]);
endtmesh();
}
static draw_elbow() {
bgntmesh();
n3f(en[0][0]); v3f(ep[0][0]);
n3f(en[1][0]); v3f(ep[1][0]);
n3f(en[0][1]); v3f(ep[0][1]);
n3f(en[1][1]); v3f(ep[1][1]);
n3f(en[0][2]); v3f(ep[0][2]);
n3f(en[1][2]); v3f(ep[1][2]);
n3f(en[0][3]); v3f(ep[0][3]);
n3f(en[1][3]); v3f(ep[1][3]);
n3f(en[0][4]); v3f(ep[0][4]);
n3f(en[1][4]); v3f(ep[1][4]);
n3f(en[0][5]); v3f(ep[0][5]);
n3f(en[1][5]); v3f(ep[1][5]);
n3f(en[0][6]); v3f(ep[0][6]);
n3f(en[1][6]); v3f(ep[1][6]);
n3f(en[0][7]); v3f(ep[0][7]);
n3f(en[1][7]); v3f(ep[1][7]);
n3f(en[0][8]); v3f(ep[0][8]);
n3f(en[1][8]); v3f(ep[1][8]);
endtmesh();
bgntmesh();
n3f(en[1][0]); v3f(ep[1][0]);
n3f(en[2][0]); v3f(ep[2][0]);
n3f(en[1][1]); v3f(ep[1][1]);
n3f(en[2][1]); v3f(ep[2][1]);
n3f(en[1][2]); v3f(ep[1][2]);
n3f(en[2][2]); v3f(ep[2][2]);
n3f(en[1][3]); v3f(ep[1][3]);
n3f(en[2][3]); v3f(ep[2][3]);
n3f(en[1][4]); v3f(ep[1][4]);
n3f(en[2][4]); v3f(ep[2][4]);
n3f(en[1][5]); v3f(ep[1][5]);
n3f(en[2][5]); v3f(ep[2][5]);
n3f(en[1][6]); v3f(ep[1][6]);
n3f(en[2][6]); v3f(ep[2][6]);
n3f(en[1][7]); v3f(ep[1][7]);
n3f(en[2][7]); v3f(ep[2][7]);
n3f(en[1][8]); v3f(ep[1][8]);
n3f(en[2][8]); v3f(ep[2][8]);
endtmesh();
bgntmesh();
n3f(en[2][0]); v3f(ep[2][0]);
n3f(en[3][0]); v3f(ep[3][0]);
n3f(en[2][1]); v3f(ep[2][1]);
n3f(en[3][1]); v3f(ep[3][1]);
n3f(en[2][2]); v3f(ep[2][2]);
n3f(en[3][2]); v3f(ep[3][2]);
n3f(en[2][3]); v3f(ep[2][3]);
n3f(en[3][3]); v3f(ep[3][3]);
n3f(en[2][4]); v3f(ep[2][4]);
n3f(en[3][4]); v3f(ep[3][4]);
n3f(en[2][5]); v3f(ep[2][5]);
n3f(en[3][5]); v3f(ep[3][5]);
n3f(en[2][6]); v3f(ep[2][6]);
n3f(en[3][6]); v3f(ep[3][6]);
n3f(en[2][7]); v3f(ep[2][7]);
n3f(en[3][7]); v3f(ep[3][7]);
n3f(en[2][8]); v3f(ep[2][8]);
n3f(en[3][8]); v3f(ep[3][8]);
endtmesh();
bgntmesh();
n3f(en[3][0]); v3f(ep[3][0]);
n3f(en[4][0]); v3f(ep[4][0]);
n3f(en[3][1]); v3f(ep[3][1]);
n3f(en[4][1]); v3f(ep[4][1]);
n3f(en[3][2]); v3f(ep[3][2]);
n3f(en[4][2]); v3f(ep[4][2]);
n3f(en[3][3]); v3f(ep[3][3]);
n3f(en[4][3]); v3f(ep[4][3]);
n3f(en[3][4]); v3f(ep[3][4]);
n3f(en[4][4]); v3f(ep[4][4]);
n3f(en[3][5]); v3f(ep[3][5]);
n3f(en[4][5]); v3f(ep[4][5]);
n3f(en[3][6]); v3f(ep[3][6]);
n3f(en[4][6]); v3f(ep[4][6]);
n3f(en[3][7]); v3f(ep[3][7]);
n3f(en[4][7]); v3f(ep[4][7]);
n3f(en[3][8]); v3f(ep[3][8]);
n3f(en[4][8]); v3f(ep[4][8]);
endtmesh();
bgntmesh();
n3f(en[4][0]); v3f(ep[4][0]);
n3f(en[5][0]); v3f(ep[5][0]);
n3f(en[4][1]); v3f(ep[4][1]);
n3f(en[5][1]); v3f(ep[5][1]);
n3f(en[4][2]); v3f(ep[4][2]);
n3f(en[5][2]); v3f(ep[5][2]);
n3f(en[4][3]); v3f(ep[4][3]);
n3f(en[5][3]); v3f(ep[5][3]);
n3f(en[4][4]); v3f(ep[4][4]);
n3f(en[5][4]); v3f(ep[5][4]);
n3f(en[4][5]); v3f(ep[4][5]);
n3f(en[5][5]); v3f(ep[5][5]);
n3f(en[4][6]); v3f(ep[4][6]);
n3f(en[5][6]); v3f(ep[5][6]);
n3f(en[4][7]); v3f(ep[4][7]);
n3f(en[5][7]); v3f(ep[5][7]);
n3f(en[4][8]); v3f(ep[4][8]);
n3f(en[5][8]); v3f(ep[5][8]);
endtmesh();
bgntmesh();
n3f(en[5][0]); v3f(ep[5][0]);
n3f(en[6][0]); v3f(ep[6][0]);
n3f(en[5][1]); v3f(ep[5][1]);
n3f(en[6][1]); v3f(ep[6][1]);
n3f(en[5][2]); v3f(ep[5][2]);
n3f(en[6][2]); v3f(ep[6][2]);
n3f(en[5][3]); v3f(ep[5][3]);
n3f(en[6][3]); v3f(ep[6][3]);
n3f(en[5][4]); v3f(ep[5][4]);
n3f(en[6][4]); v3f(ep[6][4]);
n3f(en[5][5]); v3f(ep[5][5]);
n3f(en[6][5]); v3f(ep[6][5]);
n3f(en[5][6]); v3f(ep[5][6]);
n3f(en[6][6]); v3f(ep[6][6]);
n3f(en[5][7]); v3f(ep[5][7]);
n3f(en[6][7]); v3f(ep[6][7]);
n3f(en[5][8]); v3f(ep[5][8]);
n3f(en[6][8]); v3f(ep[6][8]);
endtmesh();
}
static bend_forward() {
translate(0.0, 1.000000, 0.0);
rotate(900, 'x');
translate(0.0, -1.000000, 0.0);
}
static bend_left() {
rotate(-900, 'z');
translate(0.0, 1.000000, 0.0);
rotate(900, 'x');
translate(0.0, -1.000000, 0.0);
}
static bend_right() {
rotate(900, 'z');
translate(0.0, 1.000000, 0.0);
rotate(900, 'x');
translate(0.0, -1.000000, 0.0);
}
draw_logo() {
lmbind(MATERIAL, MAT_LOGO);
translate(5.500000, -3.500000, 4.500000);
translate(0.0, 0.0, -7.000000);
draw_double_cylinder();
bend_forward();
draw_elbow();
translate(0.0, 0.0, -7.000000);
draw_double_cylinder();
bend_forward();
draw_elbow();
translate(0.0, 0.0, -5.000000);
draw_single_cylinder();
bend_right();
draw_elbow();
translate(0.0, 0.0, -7.000000);
draw_double_cylinder();
bend_forward();
draw_elbow();
translate(0.0, 0.0, -7.000000);
draw_double_cylinder();
bend_forward();
draw_elbow();
translate(0.0, 0.0, -5.000000);
draw_single_cylinder();
bend_left();
draw_elbow();
translate(0.0, 0.0, -7.000000);
draw_double_cylinder();
bend_forward();
draw_elbow();
translate(0.0, 0.0, -7.000000);
draw_double_cylinder();
bend_forward();
draw_elbow();
translate(0.0, 0.0, -5.000000);
draw_single_cylinder();
bend_right();
draw_elbow();
translate(0.0, 0.0, -7.000000);
draw_double_cylinder();
bend_forward();
draw_elbow();
translate(0.0, 0.0, -7.000000);
draw_double_cylinder();
bend_forward();
draw_elbow();
translate(0.0, 0.0, -5.000000);
draw_single_cylinder();
bend_left();
draw_elbow();
translate(0.0, 0.0, -7.000000);
draw_double_cylinder();
bend_forward();
draw_elbow();
translate(0.0, 0.0, -7.000000);
draw_double_cylinder();
bend_forward();
draw_elbow();
translate(0.0, 0.0, -5.000000);
draw_single_cylinder();
bend_right();
draw_elbow();
translate(0.0, 0.0, -7.000000);
draw_double_cylinder();
bend_forward();
draw_elbow();
translate(0.0, 0.0, -7.000000);
draw_double_cylinder();
bend_forward();
draw_elbow();
translate(0.0, 0.0, -5.000000);
draw_single_cylinder();
bend_left();
draw_elbow();
}